<template>
    <div class="card-box">
        <v-dialog :show.sync="dialogVisible" width="70%" title="评估价历史查看" ref="dialogPriceInfo" >
            <div v-if="dialogVisible">
                <div class="card-box">
                    <div class="card-title">基础信息</div>
                    <el-form ref="form" class="form-wrap" size="small">
                        <el-form-item label="物业名称">
                            <el-input v-model="propertyName" disabled></el-input>
                        </el-form-item>
                        <el-form-item label="建筑面积（m²）">
                            <el-input v-model="buildingArea" disabled></el-input>
                        </el-form-item>
                    </el-form>
                    <div class="card-title">历史评估价格</div>
                    <el-row>
                        <el-col :span="24">
                            <el-table :data="priceInfo"  stripe>
                                <el-table-column
                                    type="index"
                                    width="50">
                                </el-table-column>
                                <el-table-column
                                    label="评估编号"
                                    width="180"
                                    prop="batch">
                                </el-table-column>
                                <el-table-column
                                    prop="price"
                                    label="物业评估价（元/㎡/月）"
                                    width="180">
                                </el-table-column>
                                <el-table-column
                                    label="评估日期"
                                    width="180"
                                    prop="assessDate">
                                </el-table-column>
                                <el-table-column
                                    label="有效日期"
                                    width="180"
                                    prop="validDate">
                                </el-table-column>
                                <el-table-column
                                    label="评估机构"
                                    width="180"
                                    prop="assessOrg">
                                </el-table-column>
                            </el-table>
                        </el-col>
                    </el-row>
                </div>
            </div>
            <div slot="foot">
                <el-button @click="dialogVisible = false">关闭</el-button>
            </div>
        </v-dialog>
    </div>
</template>

<script>
import {getPriceInfoHistory} from '../api/rent-price'

export default {

    data() {
        return {
            roomId:"",
            propertyName:"",
            buildingArea: null,
            priceInfo: {},
            dialogVisible:false
        }
    },
    mounted:
        function () {
            //this.getInfo(this.rentPiceId);
        },
    methods: {
        //加载数据
        show(roomId) {
            //保存批次信息

            this.dialogVisible=true;
            this.roomId=roomId;
            //this.$refs.dialogPriceInfo.show=true;
            //alert(JSON.stringify(this.$refs));


            getPriceInfoHistory(roomId).then(
                response=>{
                    //alert("11"+JSON.stringify(response));
                    if(response.data.code==0){
                        //this.$alert("提交成功");
                        //详细数据
                        //alert("11"+JSON.stringify(response));
                        let roomInfo=response.data.data.room
                        if(roomInfo) {
                            this.propertyName=roomInfo.property_name;
                            this.buildingArea = roomInfo.building_area;
                        }
                        this.priceInfo=response.data.data.price;
                    }
                    else {
                        this.$alert("服务端返回错误："+response.data.code+response.data.message);
                    }
                }
            ).catch(reason=>{
                    this.$alert("出错了"+JSON.stringify(reason));

                }
            );
        }

    }
}
</script>
<style scoped lang="scss">
    

    @include formWrap();
</style>


